summaryrefslogtreecommitdiffstats
path: root/prog/6/makefile
blob: 8a847a2e25d49b23f49a29e3223dde7264f39fc9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
DESTDIR=/
CC=cc
MYCFLAGS=-O0 -Wall -Wextra -Wformat -pedantic -g
MYLDFLAGS=-lresolv

default: 6d 6c

6d: daemon.c
	$(CC) $(MYCFLAGS) $(CFLAGS) $< -o$@ $(MYLDFLAGS) $(LDFLAGS)

6c: client.c
	$(CC) $(MYCFLAGS) $(CFLAGS) $< -o$@ $(MYLDFLAGS) $(LDFLAGS)

install: 6d 6c
	mkdir -p $(DESTDIR)/usr/bin/
	cp 6d $(DESTDIR)/usr/bin/
	cp 6c $(DESTDIR)/usr/bin/

uninstall:
	rm -fr $(DESTDIR)/usr/bin/6d
	rm -fr $(DESTDIR)/usr/bin/6c

distclean: clean

clean:
	rm -fr 6d 6c

valgrind:
	valgrind --error-exitcode=59 --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind-out.txt $(CMD)

# tests if code compiles under gcc, clang and tcc
cc:
	make -e CC=tcc
	make -e CC=gcc
	make -e CC=clang

.PHONY: default, install, distclean, clean, valgrind, cc, uninstall